package com.example.backend.repository;

import com.example.backend.domain.entity.NotificationTemplate;
import com.example.backend.domain.enums.NotificationChannel;
import com.example.backend.domain.enums.NotificationType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * 通知模板数据访问层
 */
@Repository
public interface NotificationTemplateRepository extends JpaRepository<NotificationTemplate, Long> {
    
    Optional<NotificationTemplate> findByCode(String code);
    
    List<NotificationTemplate> findByTypeAndActive(NotificationType type, Boolean active);
    
    List<NotificationTemplate> findByChannelAndActive(NotificationChannel channel, Boolean active);
    
    List<NotificationTemplate> findByTypeAndChannelAndActive(NotificationType type, NotificationChannel channel, Boolean active);
    
    List<NotificationTemplate> findByActive(Boolean active);
}
